package com.youhp.spire.xls.demo.RowsColumns;

import com.spire.xls.*;

public class AutoFitRowsAndColumns {
    public static void main(String[] args) {
        //Create a workbook and load an Excel file from disk.
        Workbook workbook = new Workbook();
        workbook.loadFromFile("data/AutoFitRowsAndColumns.xls");

        //Get the first worksheet.
        Worksheet worksheet = workbook.getWorksheets().get(0);

        //Set autoFit column.
        worksheet.autoFitColumn(1);
        worksheet.autoFitRow(1);

        //Save file.
        workbook.saveToFile("output/AutofitRowsandColumns.xlsx", ExcelVersion.Version2013);
    }
}
